//表单验证
$('#register-box').validate({
	selectID: "#errortip" //指定弹出位置
});

//设置vue
var app = new Vue({
	el: '#bodyapp',
	data: {
		froms: {
			name:"",
			mobile:"",
			birthday:"",
			sex:"",
			email:"",
			address:"",
			career:"",
		},
		Language:{},
		birthday:"2010-1-1",
	},
	methods: {
		Langes: function(v) {
			$.ajax({
				type: "get",
				dataType: "json",
				url: "../Langue/" + v + ".json",
				success: function(h) {
					app.Language = h;
				},
				error: function(e) {
					console.log("错误");
				}
			});
		},
		sub_form:function(){
			if($('#register-box').validate('submitValidate')){
                app.froms.card_id=sessionStorage.getItem("card_id") ;
				app.froms.sex=$("input:radio:checked").val();
				app.froms.birthday = $("#demo2").val();
				common_ajax("put_member_card_apply",this.froms,"",function(h){
					if(h.status ==1){
						sessionStorage.setItem("member_card_id",h.result.card_id);
						$(window).attr('location','../Payment/Payment.html?apply=1');
					}else{
						console.log("申请会员失败");
						debugger
					}
				});
			}
		},
		lan:function(){
			
		}
	}
})
//首次加载语言
if(localStorage.getItem("lanuage")) {
	app.Langes(localStorage.getItem("lanuage"));
} else {
	app.Langes("en");
}

